//
//  ILLog.h
//  IMIHome
//
//  Created by 杨俊 on 2018/5/4.
//  Copyright © 2018年 上海创米科技有限公司. All rights reserved.
//  ObjectC使用此类

#import <Foundation/Foundation.h>
#import <CocoaLumberjack/CocoaLumberjack.h>
#import "ILLogBridge.h"

#ifdef DEBUG
/// 定义DEBUG环境日志输出过滤级别
static const DDLogLevel ddLogLevel = DDLogLevelVerbose;
#else
/// 定义非DEBUG环境日志输出过滤级别
static const DDLogLevel ddLogLevel = DDLogLevelVerbose;
//干掉log
#define NSLog(...) {}
//干掉断言
#define NS_BLOCK_ASSERTIONS
#endif

#define IL_PRE_LOG [NSString stringWithFormat:@"[行号:%d] [文件名:%@] [函数名:%@]", __LINE__, THIS_FILE, THIS_METHOD]

#define ILLogV(format, ...) if(!ILLogBridge.bDisable){DDLogVerbose(@"%@\n",[NSString stringWithFormat:@"%@", [NSString stringWithFormat:format, ##__VA_ARGS__]]);}

#define ILLogD(format, ...) if(!ILLogBridge.bDisable){DDLogDebug(@"%@\n",[NSString stringWithFormat:@"%@", [NSString stringWithFormat:format, ##__VA_ARGS__]]);}

#define ILLogI(format, ...) if(!ILLogBridge.bDisable){DDLogInfo(@"%@\n",[NSString stringWithFormat:@"%@", [NSString stringWithFormat:format, ##__VA_ARGS__]]);}

#define ILLogW(format, ...) if(!ILLogBridge.bDisable){DDLogWarn(@"%@\n",[NSString stringWithFormat:@"%@", [NSString stringWithFormat:format, ##__VA_ARGS__]]);}

#define ILLogE(format, ...) if(!ILLogBridge.bDisable){DDLogError(@"%@\n",[NSString stringWithFormat:@"%@", [NSString stringWithFormat:format, ##__VA_ARGS__]]);}

//log
#define IL_LOG_LINE_PRETTY_FUNCTION  NSLog(@"line[%d] %s", __LINE__, __PRETTY_FUNCTION__)

//func log
#define ILLogFuncV ILLogV(@"line[%d] [%@ call %@]", __LINE__, THIS_FILE, THIS_METHOD)
#define ILLogFuncD ILLogD(@"line[%d] [%@ call %@]", __LINE__, THIS_FILE, THIS_METHOD)
#define ILLogFuncI ILLogI(@"line[%d] [%@ call %@]", __LINE__, THIS_FILE], THIS_METHOD)
#define ILLogFuncW ILLogW(@"line[%d] [%@ call %@]", __LINE__, THIS_FILE, THIS_METHOD)
#define ILLogFuncE ILLogE(@"line[%d] [%@ call %@]", __LINE__, THIS_FILE, THIS_METHOD)

@interface ILLog : NSObject

- (instancetype)init NS_UNAVAILABLE;
- (instancetype)new NS_UNAVAILABLE;
- (id)copy NS_UNAVAILABLE;
- (id)mutableCopy NS_UNAVAILABLE;

/// 获取实例
+ (instancetype)sharedInstance;

/// 本地日志输入日志设置
/// - Parameter level: 写入本地日志文件的Log级别,
/// 通常我们将此处设置为所有级别的日志都写入即可
/// 应该去控制输出日志级别,进而控制写入到本地的日志级别
- (void)setupFileLogWithLogLevel:(DDLogLevel)level;

/// 在控制台输出日志
/// - Parameter level: 控制台输出的日志级别
- (void)setupConsoleLogWithLogLevel:(DDLogLevel)level;

/// 获取本地日志文件所在的位置
- (NSArray<NSString*> *)getLogsPath;

@end
